<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">

<h:body>
	<ui:composition template="/WEB-INF/template/template_default.xhtml">
		<ui:define name="content">


			<table id="table">
				<tr>
					<th></th>
					<th>Nome</th>
					<th>Descrição</th>
					<th>Tamanho</th>
					<th>Preço</th>

				</tr>
				<ui:repeat value="#{carrinhoBean.listar()}" var="carrinhoProd">
					<tr>
						<td><h:graphicImage value="#{carrinhoProd.picture}" width="150" height="150" /></td>
						<td id="name_carrinho"><h:outputText
								value="#{carrinhoProd.name}"></h:outputText></td>
						<td id="desc_carrinho"><h:outputText
								value="#{carrinhoProd.description}"></h:outputText></td>
						<td><h:outputText value="#{carrinhoProd.tamanho}"></h:outputText></td>
						<td><h:outputText value="R$ #{carrinhoProd.preço}"></h:outputText></td>
						<h:form>
							<td><h:commandLink
									actionListener="#{carrinhoBean.remover(carrinhoProd)}"
									value="Remover" /></td>
						</h:form>
					</tr>
				</ui:repeat>
				<tr>
					<td colspan="3">Total:</td>
					<td><h:outputText value="R$ #{carrinhoBean.calculaSubtotal()}"></h:outputText></td>
				</tr>
			</table>

			<br />
			
			<div align="left">
				<p:commandButton value="Confirmar compra"
					action="#{carrinhoBean.confirmaCompra}" icon="ui-icon-check" />
			</div>

		</ui:define>
	</ui:composition>
</h:body>
</html>